home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
IRIX Base Documentation 1998 November
/
IRIX 6.5.2 Base Documentation November 1998.img
/
usr
/
share
/
catman
/
u_man
/
cat3
/
Tk
/
getimage.z
/
getimage
Wrap
Text File
|
1998-10-30
|
10KB
|
199 lines
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk)))) TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk))))
NNNNAAAAMMMMEEEE
Tk_GetImage, Tk_RedrawImage, Tk_SizeOfImage, Tk_FreeImage - use an image
in a widget
SSSSYYYYNNNNOOOOPPPPSSSSIIIISSSS
####iiiinnnncccclllluuuuddddeeee <<<<ttttkkkk....hhhh>>>>
Tk_Image
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee(_i_n_t_e_r_p, _t_k_w_i_n, _n_a_m_e, _c_h_a_n_g_e_P_r_o_c, _c_l_i_e_n_t_D_a_t_a)
TTTTkkkk____RRRReeeeddddrrrraaaawwwwIIIImmmmaaaaggggeeee(_i_m_a_g_e, _i_m_a_g_e_X, _i_m_a_g_e_Y, _w_i_d_t_h, _h_e_i_g_h_t, _d_r_a_w_a_b_l_e,
_d_r_a_w_a_b_l_e_X, _d_r_a_w_a_b_l_e_Y)
TTTTkkkk____SSSSiiiizzzzeeeeOOOOffffIIIImmmmaaaaggggeeee(_i_m_a_g_e, _w_i_d_t_h_P_t_r, _h_e_i_g_h_t_P_t_r)
TTTTkkkk____FFFFrrrreeeeeeeeIIIImmmmaaaaggggeeee(_i_m_a_g_e)
AAAARRRRGGGGUUUUMMMMEEEENNNNTTTTSSSS
Tcl_Interp *_i_n_t_e_r_p (in) Place to leave error
message.
Tk_Window _t_k_w_i_n (in) Window in which image will
be used.
char *_n_a_m_e (in) Name of image.
Tk_ImageChangedProc *_c_h_a_n_g_e_P_r_o_c (in) Procedure for Tk to invoke
whenever image content or
size changes.
ClientData _c_l_i_e_n_t_D_a_t_a (in) One-word value for Tk to
pass to _c_h_a_n_g_e_P_r_o_c.
Tk_Image _i_m_a_g_e Token for image instance;
must have been returned by
a previous call to
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee.
int _i_m_a_g_e_X (in) X-coordinate of upper-left
corner of region of image
to redisplay (measured in
pixels from the image's
upper-left corner).
int _i_m_a_g_e_Y (in) Y-coordinate of upper-left
corner of region of image
to redisplay (measured in
pixels from the image's
upper-left corner).
PPPPaaaaggggeeee 1111
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk)))) TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk))))
int _w_i_d_t_h ((in)) Width of region of image to
redisplay.
int _h_e_i_g_h_t ((in)) Height of region of image
to redisplay.
Drawable _d_r_a_w_a_b_l_e (in) Where to display image.
Must either be window
specified to TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee or
a pixmap compatible with
that window.
int _d_r_a_w_a_b_l_e_X (in) Where to display image in
_d_r_a_w_a_b_l_e: this is the x-
coordinate in _d_r_a_w_a_b_l_e
where x-coordinate _i_m_a_g_e_X
of the image should be
displayed.
int _d_r_a_w_a_b_l_e_Y (in) Where to display image in
_d_r_a_w_a_b_l_e: this is the y-
coordinate in _d_r_a_w_a_b_l_e
where y-coordinate _i_m_a_g_e_Y
of the image should be
displayed.
int _w_i_d_t_h_P_t_r (out) Store width of _i_m_a_g_e (in
pixels) here.
int _h_e_i_g_h_t_P_t_r (out) Store height of _i_m_a_g_e (in
pixels) here.
DDDDEEEESSSSCCCCRRRRIIIIPPPPTTTTIIIIOOOONNNN
These procedures are invoked by widgets that wish to display images.
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee is invoked by a widget when it first decides to display an
image. _n_a_m_e gives the name of the desired image and _t_k_w_i_n identifies the
window where the image will be displayed. TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee looks up the image
in the table of existing images and returns a token for a new instance of
the image. If the image doesn't exist then TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee returns NULL and
leaves an error message in _i_n_t_e_r_p->_r_e_s_u_l_t.
When a widget wishes to actually display an image it must call
TTTTkkkk____RRRReeeeddddrrrraaaawwwwWWWWiiiiddddggggeeeetttt, identifying the image (_i_m_a_g_e), a region within the image
to redisplay (_i_m_a_g_e_X, _i_m_a_g_e_Y, _w_i_d_t_h, and _h_e_i_g_h_t), and a place to display
the image (_d_r_a_w_a_b_l_e, _d_r_a_w_a_b_l_e_X, and _d_r_a_w_a_b_l_e_Y). Tk will then invoke the
appropriate image manager, which will display the requested portion of
the image before returning.
A widget can find out the dimensions of an image by calling
TTTTkkkk____SSSSiiiizzzzeeeeOOOOffffIIIImmmmaaaaggggeeee: the width and height will be stored in the locations
given by _w_i_d_t_h_P_t_r and _h_e_i_g_h_t_P_t_r, respectively.
PPPPaaaaggggeeee 2222
TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk)))) TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee((((3333TTTTkkkk))))
When a widget is finished with an image (e.g., the widget is being
deleted or it is going to use a different image instead of the current
one), it must call TTTTkkkk____FFFFrrrreeeeeeeeIIIImmmmaaaaggggeeee to release the image instance. The
widget should never again use the image token after passing it to
TTTTkkkk____FFFFrrrreeeeeeeeIIIImmmmaaaaggggeeee. There must be exactly one call to TTTTkkkk____FFFFrrrreeeeeeeeIIIImmmmaaaaggggeeee for each
call to TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee.
If the contents or size of an image changes, then any widgets using the
image will need to find out about the changes so that they can redisplay
themselves. The _c_h_a_n_g_e_P_r_o_c and _c_l_i_e_n_t_D_a_t_a arguments to TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee are
used for this purpose. _c_h_a_n_g_e_P_r_o_c will be called by Tk whenever a change
occurs in the image; it must match the following prototype:
typedef void Tk_ImageChangedProc(
ClientData _c_l_i_e_n_t_D_a_t_a,
int _x,
int _y,
int _w_i_d_t_h,
int _h_e_i_g_h_t,
int _i_m_a_g_e_W_i_d_t_h,
int _i_m_a_g_e_H_e_i_g_h_t);
The _c_l_i_e_n_t_D_a_t_a argument to _c_h_a_n_g_e_P_r_o_c is the same as the _c_l_i_e_n_t_D_a_t_a
argument to TTTTkkkk____GGGGeeeettttIIIImmmmaaaaggggeeee. It is usually a pointer to the widget record
for the widget or some other data structure managed by the widget. The
arguments _x, _y, _w_i_d_t_h, and _h_e_i_g_h_t identify a region within the image that
must be redisplayed; they are specified in pixels measured from the
upper-left corner of the image. The arguments _i_m_a_g_e_W_i_d_t_h and _i_m_a_g_e_H_e_i_g_h_t
give the image's (new) size.
SSSSEEEEEEEE AAAALLLLSSSSOOOO
Tk_CreateImageType
KKKKEEEEYYYYWWWWOOOORRRRDDDDSSSS
images, redisplay
PPPPaaaaggggeeee 3333